///
/// @ProjectName:    learning_rust
/// @Description:    
/// @File:           jz13.rs
/// @Author:         wujehy
/// @Email:          wujehy@qq.com
/// @Time:           2021-07-01 22:20
///

use std::cmp::Ordering;

struct Solution {}

impl Solution {
    fn new() -> Solution {
        Solution {}
    }
    #[allow(non_snake_case)]
    pub fn reOrderArray(&self ,array: Vec<i32>) -> Vec<i32> {
        // write code here
        let mut array = array;
        array.sort_by(|a , b |-> Ordering{
            match a & 0x1 == 0x1 && b & 0x1 == 0x0  {
                true => {
                    Ordering::Less
                }
                false => {
                    Ordering::Equal
                }
            }
        });
        array
    }
}

#[test]
fn test13(){
    let s = Solution::new();
    let input = vec![1,2,3,4];
    let expext = vec![1,3,2,4];
    let result =  s.reOrderArray(input);
    println!("result : {:?}", result);
    assert_eq!(expext, result);
}